import Page
from Page import Yomi
from Base.Base import Base
from selenium.webdriver.common.by import By


class YomiDeletePage(Base):
    """
    语音训练删除页(技能展示页面)

    """

    def __init__(self, driver):
        Base.__init__(self, driver)

        # 左侧的home键
        self.delete_home_btn = (By.XPATH, Yomi.RESOURCE_ID.format("ivHome"))

        # 左侧的返回键
        self.delete_back_btn = (By.XPATH, Yomi.RESOURCE_ID.format('ivBack'))

        # 退出标题
        self.delete_title_text = (By.XPATH, Yomi.RESOURCE_ID.format("tv_title"))

        # 技能图
        self.delete_skill_pic = (By.XPATH, Yomi.RESOURCE_ID.format("view_bg"))

        # 编辑按钮
        self.delete_edit_btn = (By.XPATH, Yomi.RESOURCE_ID.format("btn_edit"))

        # 删除按钮
        self.delete_cancel_btn = (By.XPATH, Yomi.RESOURCE_ID.format("btn_del"))

    def click_back(self):
        """
        点击左侧的back键

        :return:None
        """
        self.click_element(self.delete_back_btn)

    def click_home(self):
        """
        点击左侧的home键

        :return:None
        """
        self.click_element(self.delete_home_btn)

    def get_title(self):
        """
        获取退出标题

        :return:获取元素
        """
        return self.find_element_o(self.delete_title_text)

    def get_skill(self):
        """
        获取技能图片

        :return:获取元素
        """
        return self.find_element_o(self.delete_skill_pic)

    def click_edit(self):
        """
        点击编辑按钮

        :return:None
        """
        self.click_element(self.delete_edit_btn)

    def click_no(self):
        """
        点击删除按钮

        :return:None
        """
        self.click_element(self.delete_cancel_btn)

    def is_display_yomi_delete(self):
        """
        查看是否进入删除页

        :return:
        """
        return self.is_display(self.delete_title_text)
